@use "dimension";

// Position Mixin
@mixin position($type) {
    position: if($type == 'sticky', '-webkit-sticky', $type);
    position: $type;
}

// Edge Offset Mixin
@mixin edge-offset($property, $size) {
    #{$property}: $size;
}

// Define a map for sizes
dimension.$sizes: (
    0: 0,
    1: 0.25rem,
    2: 0.5rem,
    3: 1rem,
    4: 2.5rem,
    5: 5rem
);

// Position Classes
.aperture-static { @include position(static); }
.aperture-relative { @include position(relative); }
.aperture-absolute { @include position(absolute); }
.aperture-fixed { @include position(fixed); }
.aperture-sticky { @include position(sticky); }

// Edge Classes
@each $key, $value in dimension.$sizes {
    .aperture-top-#{$key} { @include edge-offset(top, $value); }
    .aperture-end-#{$key} { @include edge-offset(right, $value); }
    .aperture-bottom-#{$key} { @include edge-offset(bottom, $value); }
    .aperture-start-#{$key} { @include edge-offset(left, $value); }
}
